﻿using System;
using System.Windows.Forms;
using JYAG.PassiveViewControlModel.Controls;
using JYAG.PassiveViewControlModel.Examples.UI.Presenters;
using JYAG.PassiveViewControlModel.Examples.UI.Views;

namespace JYAG.PassiveViewControlModel.Examples.Winforms
{
    /// <summary>
    /// A simple login form
    /// </summary>
    public partial class SimpleLoginForm : Form, ISimpleLoginFormView
    {
        private SimpleLoginFormPresenter presenter;

        /// <summary>
        /// Initializes a new instance of the <see cref="SimpleLoginForm"/> class.
        /// </summary>
        public SimpleLoginForm()
        {
            InitializeComponent();
            this.presenter = new SimpleLoginFormPresenter(this);
        }

        #region Implementation of ISimpleLoginFormView

        /// <summary>
        /// A Textbox for the username.
        /// </summary>
        /// <value>The textbox for the username.</value>
        ITextBox ISimpleLoginFormView.Username
        {
            get { return this.usernameTextBox; }
        }

        /// <summary>
        /// A Textbox for the password.
        /// </summary>
        /// <value>The Textbox for the password.</value>
        ITextBox ISimpleLoginFormView.Password
        {
            get { return this.passwordTextBox; }
        }

        /// <summary>
        /// Gets the button to log on.
        /// </summary>
        /// <value>The button to log on.</value>
        IButton ISimpleLoginFormView.LogOn
        {
            get { return this.loginButton; }
        }

        /// <summary>
        /// A Label for the result.
        /// </summary>
        /// <value>The label for the result.</value>
        ILabel ISimpleLoginFormView.Result
        {
            get { return this.resultLabel; }
        }

        #endregion
    }
}
